

{% extends 'base.html' %}

{% block  css-page %}

    <link href="/static/datatable/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">

    <!-- DataTables Responsive CSS -->
    <link href="/static/datatable/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet">
{% endblock %}



{% block page-content %}
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">资产修改</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                

                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            资产信息修改
                        </div>
                        <div  class="panel-body">
                            <!-- Tab panes -->
                            <div class="tab-content">
                                <div id="oneserver" class="tab-pane fade active in">
                                </br>
                                    <form class="form-horizontal nice-validator n-yellow" method="post"  >

                                        <div class="panel-body">
                                            <div class="col-lg-5">
                                                <div class="panel panel-info">
                                                    <div class="panel-heading">
                                                        基本信息
                                                    </div>
                                                 <div class="ibox-content" style="display: block;">
                                                     <div>
                                                            <br>
                                                                <div class="form-group"><label class="col-sm-3 control-label"> CPU<span class="red-fonts"></span> </label>
                                                                    <div class="col-sm-8"><input type="text" class="form-control" name="cpu"  value="{{cmdbdata.cpu}}" required="true" ></div>
                                                                </div>


                                                                <div class="form-group"><label class="col-sm-3 control-label"> 主板<span class="red-fonts"></span> </label>
                                                                    <div class="col-sm-8"><input type="text" class="form-control"  name="motherboard"  value="{{cmdbdata.motherboard}}" required="true" ></div>
                                                                </div>

                                                                <div class="form-group"><label class="col-sm-3 control-label"> 内存条<span class="red-fonts"></span> </label>
                                                                    <div class="col-sm-8"><input type="text" class="form-control" name="memory"  value="{{cmdbdata.memory}}" required="true"></div>
                                                                </div>

                                                               <div class="form-group"><label class="col-sm-3 control-label"> 显卡<span class="red-fonts"></span> </label>
                                                                    <div class="col-sm-8"><input type="text" class="form-control"  name="graphics"   value="{{cmdbdata.graphics}}" required="true"></div>
                                                                </div>

                                                                <div class="hr-line-dashed"></div>
                                                                <div class="form-group">
                                                                    <label class="col-sm-3 control-label" >部门<span class="red-fonts"></span> </label>
                                                                    <div class="col-sm-8">
                                                                        <select class="form-control m-b" name="dept"  >
                                                                            {% for d in deptdata%}
                                                                                {%if cmdbdata.dept.id == d.id%}
                                                                                    <option value="{{d.id}}" selected> {{d.name}}</option>
                                                                                {%else%}
                                                                                    <option value="{{d.id}}"> {{d.name}}</option>
                                                                                {%endif%}
                                                                            {% endfor %}
                                                                        </select>
                                                                    </div>
                                                                </div>

                                                              </div>
                                                         </div>
                                                                                            
                                                     </div>
                                                 </div>

                                       <div class="col-lg-7">
                                                                                   
                                            <div class="panel panel-info">
                                                       <div class="panel-heading">
                                                                  基它信息
                                                        </div>
                                            <div class="ibox-content" style="display: block;">


                                            <div>
                                                <br>
                                              
                                                   <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 硬盘<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control"  value="{{cmdbdata.hard_disk1}}" name="hard_disk1"  ></div>
                                                    </div>

                                                <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 键盘/鼠标<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control"  value="{{cmdbdata.keyboard}}" name="keyboard"  ></div>
                                                    </div>


                                                   <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 机箱<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control" value="{{cmdbdata.chassis}}" name="chassis"  ></div>
                                                    </div>

                                                    <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 电源<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control"  value="{{cmdbdata.power_supply}}" name="power_supply"  ></div>
                                                    </div>

                                                    <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 显示器<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control"  value="{{cmdbdata.monitor}}" name="monitor"  ></div>
                                                    </div>

                                                    <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 使用者<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control"  value="{{cmdbdata.who_uses}}" name="who_uses"  ></div>
                                                    </div>

                                                    <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 采购价<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><input type="text" class="form-control"  value="{{cmdbdata.price}}" name="price"  ></div>
                                                    </div>

                                                    <div class="hr-line-dashed"></div>
                                                    <div class="form-group">
                                                        <label class="col-sm-2 control-label" for="l_applist">供应商<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-6">
                                                            <select class="form-control m-b" name="supplier" >
                                                                {%for i in suppdata%}
                                                                    {%if cmdbdata.supplier.id == i.id %}
                                                                        <option value="{{i.id}}" selected>{{i.supplier_name}}</option>
                                                                    {%else%}
                                                                        <option value="{{i.id}}">{{i.supplier_name}}</option>
                                                                    {%endif%}
                                                                {%endfor%}
                                                            </select>
                                                        </div>
                                                    </div>


                                                <div class="hr-line-dashed"></div>
                                                    <div class="form-group"><label class="col-sm-2 control-label"> 备注<span class="red-fonts"></span> </label>
                                                        <div class="col-sm-8"><textarea rows="3" class="form-control"   name="description">{{cmdbdata.comment}}</textarea></div>
                                                    </div>


                                            </div>
                                        </div>
                                        </div>
                                        </div>

                                             {% csrf_token %}

                                                     <div class="form-group">
                                                         <div class="col-sm-4 col-sm-offset-5">
                                                          <button type="reset" class="btn btn-white"> 重置 </button>
                                                          <button type="button" class="btn btn-primary" id="serveradd"> 提交 </button>
                                                         </div>
                                                    </div>
                                            </div>
                                    </form>
                                </div>






                            </div>
                        </div>
                    </div>
                    <!-- /.panel -->


                <div class="modal fade" id="myModal" tabindex="-1" role="dialog"  id="myModal" aria-labelledby="myModalLabel">
              <div class="modal-dialog" role="document">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">系统提示</h4>
                  </div>
                  <div class="modal-body">
                         <p id="getdata">ddddddd</p>
                  </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <a class="btn btn-primary" href="/cmdb/list/">确定</a>

                    </div>
                </div>
              </div>
            </div>

                </div>
            </div>
            <!-- /.row -->

             <script>
                       $(function(){
                            $("#serveradd").click(function() {

                                $.post("",
                                         {cpu: $("input[name='cpu']").val(),
                                               motherboard: $("input[name='motherboard']").val(),
                                               memory: $("input[name='memory']").val(),
                                               graphics: $("input[name='graphics']").val(),
                                               hard_disk1: $("input[name='hard_disk1']").val(),
                                               keyboard: $("input[name='keyboard']").val(),
                                               chassis: $("input[name='chassis']").val(),
                                               power_supply: $("input[name='power_supply']").val(),
                                               monitor: $("input[name='monitor']").val(),
                                               who_uses: $("input[name='who_uses']").val(),
                                               price: $("input[name='price']").val(),
                                               supplier: $("select[name='supplier']").val(),
                                               dept: $("select[name='dept']").val(),
                                               comment: $("input[name='description']").val(),
                                               csrfmiddlewaretoken: '{{ csrf_token }}'},
                                         function (data) {
                                            $("#getdata").html(data);
                                            $('#myModal').modal('show');
                                        });
                            });

                        });
                  </script>




   {% endblock %}



